<?php

class Adept_Template_Tag_Set extends Adept_Template_Tag 
{

    public function prepare() 
    {
    	if (!$this->hasAttribute('name')) {
    	    throw new Adept_Template_Exception("Attribute 'name' required ", array(), $this->getLocation());
    	}
    	parent::prepare();
    }	
    
    public function generate($writer) 
    {
    	$name = $this->getAttributeValue('name');
    	$writer->writePhp("\$context['{$name}'] = ");
    	$this->getAttribute('value')->generate($writer);
    	$writer->writePhp("; \n");
    }	
    
}
